package com.example.wangyongdong.bearsqlitedemo;

import com.example.wangyongdong.bearsqlitedemo.Interface.BearJson;
import com.jakewharton.retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;

import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

/**
 * Created by wangyongdong on 2017/4/27.
 */

public class HttpManager {
    private static class SingletonHolder {
        private static final HttpManager INSTANCE = new HttpManager();
    }

    public static HttpManager getInstance() {
        return SingletonHolder.INSTANCE;
    }

    private Retrofit retrofit;

    private BearJson service;

    private HttpManager() {
        retrofit = new Retrofit.Builder()
                .baseUrl(BearJson.BEAR_URL)
                .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
                .addConverterFactory(GsonConverterFactory.create())
                .build();
        service = retrofit.create(BearJson.class);
    }

    public BearJson getService() {
        return service;
    }


}